home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / WINPROGS / PCL4W10.ZIP / SIMPL_IO.C < prev    next >
Text File  |  1994-02-05  |  1KB  |  65 lines

  1. /*** SIMPL_IO.C ***/
  2.  
  3. #include "windows.h"
  4. #include "stdio.h"
  5. #include "string.h"
  6. #include "pcl4w.h"
  7. #include "simple.h"
  8. #include "ascii.h"
  9. #include "sioerror.h"
  10. #include "simpl_io.h"
  11. #include "paint.h"
  12.  
  13. char Temp[256];
  14.  
  15. /*** output character to serial port ***/
  16.  
  17. int PutChar(int Port, char ch)
  18. {int rc;
  19.  /* transmit character */
  20.  rc = SioPutc(Port,ch);
  21.  if(rc<0)
  22.      {/* error */
  23.       SioError(rc,"SioPutc");
  24.       SioDone(Port);
  25.      }
  26.  return(rc);
  27. }
  28.  
  29. /*** receive character from serial port ***/
  30.  
  31. int GetChar(int Port)
  32. {int rc;
  33.  rc = SioGetc(Port);
  34.  if(rc<-1)
  35.      {/* error */
  36.       SioError(rc,"SioGetc");
  37.       SioDone(Port);
  38.      }
  39.  return(rc);
  40. }
  41.  
  42.  
  43. /*** display the error text ***/
  44.  
  45. void SayError(int Port, char *ptr)
  46. {char temp[81];
  47.  sprintf(temp,"ERROR! COM%d : %s",1+Port,ptr);
  48.  DisplayLine(temp);
  49.  /* cancel remote */
  50.  PutChar(Port,CAN);
  51.  PutChar(Port,CAN);
  52.  PutChar(Port,CAN);
  53. } /* end SayError */
  54.  
  55. /*** display line on TERM client area ***/
  56.  
  57. char CRLF[2] = {CR,LF};
  58.  
  59. void DisplayLine(char *Ptr)
  60. {
  61.  WriteTheString("<",1);
  62.  WriteTheString(Ptr,strlen(Ptr));
  63.  WriteTheString(">",1);
  64.  WriteTheString(CRLF,2);
  65. } /* end DisplayLine */